package org.example.chap01;

/**
 * https://leetcode.com/problems/climbing-stairs/
 */
public class ClimbStairs {

    public static void main(String[] args) {
        int result = solution1(4);
        System.out.println("result:"+result);
    }

    public static int solution1(int nums){
        if(nums<=2){
            return nums;
        }
        int f1=1,f2=2,f3=3;
        for (int i = 3; i < nums+1; i++) {
            f3 = f1+f2;
            f1=f2;
            f2=f3;
        }
        return f3;
    }
}
